package org.jeecg.modules.iot.mqtt.server.service.processor.control;

import org.jeecg.modules.iot.jtt808.JTT808Message;
import org.jeecg.modules.iot.model.Jt808Control.Jt808CentralControlConfig;
import org.jeecg.modules.iot.model.modbus.ModbusParams;
import org.jeecg.modules.iot.mqtt.server.service.processor.JT808MessageGenerator;
import org.jeecg.modules.iot.mqtt.server.service.processor.MessageType;
import org.jeecg.modules.iot.utils.ModbusRTUUtils;
import org.springframework.stereotype.Component;

@Component
public class QueryControlMessageGenerator implements JT808MessageGenerator {
    @Override
    public String generateMessage(JTT808Message message) {
        return "";
    }

    @Override
    public String generateMessage(JTT808Message message, Jt808CentralControlConfig config) {
        return "";
    }

    @Override
    public String generateMessage(JTT808Message message, ModbusParams params) {
        byte transparentMsgType = (byte) 0x41;
        int messageId=0x8900;
        return ModbusRTUUtils.generateModbusTransparentMessage(message, params, transparentMsgType, messageId);
    }

    @Override
    public String getType() {
        return MessageType.QUERY_CONTROL.name();
    }
}